+Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktext.c: Optimizations for moving point n
+ places.
+ (gtk-mailund-980718-0, Thomas Mailund Jensen <mailund@daimi.aau.dk>)
+
+ * gtk/gtkfixed.c: Removed gtk_fixed_umap, which was
+ broken. (GtkWidget's default unmap handler should work fine).
+ Pointed out by Patrice Fortier <Patrice.Fortier@aquarel.fr>
+
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
+Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktext.c: Optimizations for moving point n
+ places.
+ (gtk-mailund-980718-0, Thomas Mailund Jensen <mailund@daimi.aau.dk>)
+
+ * gtk/gtkfixed.c: Removed gtk_fixed_umap, which was
+ broken. (GtkWidget's default unmap handler should work fine).
+ Pointed out by Patrice Fortier <Patrice.Fortier@aquarel.fr>
+
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
+Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktext.c: Optimizations for moving point n
+ places.
+ (gtk-mailund-980718-0, Thomas Mailund Jensen <mailund@daimi.aau.dk>)
+
+ * gtk/gtkfixed.c: Removed gtk_fixed_umap, which was
+ broken. (GtkWidget's default unmap handler should work fine).
+ Pointed out by Patrice Fortier <Patrice.Fortier@aquarel.fr>
+
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
+Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktext.c: Optimizations for moving point n
+ places.
+ (gtk-mailund-980718-0, Thomas Mailund Jensen <mailund@daimi.aau.dk>)
+
+ * gtk/gtkfixed.c: Removed gtk_fixed_umap, which was
+ broken. (GtkWidget's default unmap handler should work fine).
+ Pointed out by Patrice Fortier <Patrice.Fortier@aquarel.fr>
+
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
+Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktext.c: Optimizations for moving point n
+ places.
+ (gtk-mailund-980718-0, Thomas Mailund Jensen <mailund@daimi.aau.dk>)
+
+ * gtk/gtkfixed.c: Removed gtk_fixed_umap, which was
+ broken. (GtkWidget's default unmap handler should work fine).
+ Pointed out by Patrice Fortier <Patrice.Fortier@aquarel.fr>
+
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
+Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktext.c: Optimizations for moving point n
+ places.
+ (gtk-mailund-980718-0, Thomas Mailund Jensen <mailund@daimi.aau.dk>)
+
+ * gtk/gtkfixed.c: Removed gtk_fixed_umap, which was
+ broken. (GtkWidget's default unmap handler should work fine).
+ Pointed out by Patrice Fortier <Patrice.Fortier@aquarel.fr>
+
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
+Mon Nov 16 15:10:33 1998 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtktext.c: Optimizations for moving point n
+ places.
+ (gtk-mailund-980718-0, Thomas Mailund Jensen <mailund@daimi.aau.dk>)
+
+ * gtk/gtkfixed.c: Removed gtk_fixed_umap, which was
+ broken. (GtkWidget's default unmap handler should work fine).
+ Pointed out by Patrice Fortier <Patrice.Fortier@aquarel.fr>
+
Mon Nov 16 00:59:26 PST 1998 Manish Singh <yosh@gimp.org>
* gtk/gtkmenubar.[ch]: added shadow_type setting and
static void gtk_fixed_class_init (GtkFixedClass *klass);
static void gtk_fixed_init (GtkFixed *fixed);
static void gtk_fixed_map (GtkWidget *widget);
-static void gtk_fixed_unmap (GtkWidget *widget);
static void gtk_fixed_realize (GtkWidget *widget);
static void gtk_fixed_size_request (GtkWidget *widget,
GtkRequisition *requisition);
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
widget_class->map = gtk_fixed_map;
- widget_class->unmap = gtk_fixed_unmap;
widget_class->realize = gtk_fixed_realize;
widget_class->size_request = gtk_fixed_size_request;
widget_class->size_allocate = gtk_fixed_size_allocate;
}
}
-static void
-gtk_fixed_unmap (GtkWidget *widget)
-{
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_FIXED (widget));
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-}
-
static void
gtk_fixed_realize (GtkWidget *widget)
{
decrement_mark_n(mark, -n);
}
-static void
-advance_mark_n (GtkPropertyMark* mark, gint n)
-{
- gint i;
-
- g_assert (n > 0);
-
- for (i = 0; i < n; i += 1)
- advance_mark (mark);
-}
-
static void
advance_mark (GtkPropertyMark* mark)
{
}
}
+static void
+advance_mark_n (GtkPropertyMark* mark, gint n)
+{
+ gint i;
+ TextProperty* prop;
+
+ g_assert (n > 0);
+
+ i = 0; /* otherwise it migth not be init. */
+ prop = MARK_CURRENT_PROPERTY(mark);
+
+ if ((prop->length - mark->offset - 1) < n) { /* if we need to change prop. */
+ /* to make it easier */
+ n += (mark->offset);
+ mark->index -= mark->offset;
+ mark->offset = 0;
+ /* first we take seven-mile-leaps to get to the right text
+ * property. */
+ while ((n-i) > prop->length - 1) {
+ i += prop->length;
+ mark->index += prop->length;
+ mark->property = MARK_NEXT_LIST_PTR (mark);
+ prop = MARK_CURRENT_PROPERTY (mark);
+ }
+ }
+
+ /* and then the rest */
+ mark->index += n - i;
+ mark->offset += n - i;
+}
+
static void
decrement_mark (GtkPropertyMark* mark)
{
static void
decrement_mark_n (GtkPropertyMark* mark, gint n)
{
- gint i;
-
g_assert (n > 0);
-
- for (i = 0; i < n; i += 1)
- decrement_mark (mark);
-}
+ while (mark->offset < n) {
+ /* jump to end of prev */
+ n -= mark->offset + 1;
+ mark->index -= mark->offset + 1;
+ mark->property = MARK_PREV_LIST_PTR (mark);
+ mark->offset = MARK_CURRENT_PROPERTY (mark)->length - 1;
+ }
+
+ /* and the rest */
+ mark->index -= n;
+ mark->offset -= n;
+}
+
static GtkPropertyMark
find_mark (GtkText* text, guint mark_position)
{
return find_mark_near (text, mark_position, &text->point);
}
-/* This can be optimized in two ways.
- * First, advances can be made in units of the current TextProperty
- * length, when possible. This will reduce computation and function
- * call overhead.
- *
+/*
* You can also start from the end, what a drag.
*/
static GtkPropertyMark
mark.property = text->text_properties;
mark.offset = 0;
}
-
- if (mark.index > mark_position)
- {
- while (mark.index > mark_position)
- decrement_mark (&mark);
- }
- else
- {
- while (mark_position > mark.index)
- advance_mark (&mark);
- }
-
+
+ move_mark_n (&mark, mark_position - mark.index);
+
return mark;
}